import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

/**
 * @author 35326
 * @date 2021/3/9 19:23
 */
public class PropertiesTest {
    public static void main(String[] args) {
        Properties properties = new Properties();
        try {
            properties.load(new FileInputStream("my.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        Thread thread = new Thread(){
            public void run(){
                while(true){
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println(properties.getProperty("user"));
                }

            }
        };
        thread.start();
    }
}
